Inspection device for mouth of container

ABSTRACT

A container mouth inspection device which can produce an ideal optical image that reliably provides information on the inner contour of the container mouth, and which enables accurate and speedy measurement of the inside diameter or the like of the container mouth. The container mouth inspection device includes a light source ( 2 ) for emitting diffused light to the bottom ( 99   b ) of the container ( 99 ) having a mouth ( 99   a ), and an optical system ( 1 ) in which a lens ( 10 ) and a diaphragm ( 11 ) are arranged along an optical axis ( 5 ) extending through the center of the mouth ( 99   a ) of the container ( 99 ) such that the diaphragm ( 11 ) is positioned behind the lens ( 10 ). The diaphragm ( 11 ) is offset backward from a back focus of the lens ( 10 ) along the optical axis ( 5 ) by a predetermined distance d so as to form an optical image of the mouth ( 99   a ) in a position behind the diaphragm ( 11 ).

TECHNICAL FIELD

The present invention relates to an optical, non-contact container mouthinspection device for inspecting the inside diameter, inner contour, orthe like of the mouth of containers such as glass bottles, PET bottles,and the like.

BACKGROUND ART

In an inspection process in the production of containers having a mouth,the outside diameter, inside diameter, and slope and the like of the topsurface of the mouth are examined. A conventional method adopted in thismouth inspection process uses a closure member having a predetermineddiameter, which is inserted into the mouth to inspect the mouth insidediameter. With this inspection method, if the closure member can beinserted into the mouth, the container is determined to be “good,”whereas, if the closure member cannot be inserted into the mouth, thecontainer is determined to be “defective.”

However, such an inspection method in which a closure member iscontacted with the inner surface of the mouth is not welcomeparticularly for containers for holding food or beverage, and the trendis toward non-contact inspection methods, for example, using opticaldevices.

FIG. 10 illustrates a common inspection device using an optical device.In the drawing, 101 denotes a light source for generating diffusedlight. Part of the light from the light source 101 is projected to thebottom 99 b of the container 99 through a circular aperture 103 in adiaphragm plate 102. The optical axis 104 extends through the center ofthe mouth 99 a of the container 99, and the optical device 100 isarranged on the optical axis 104 above the container 99. The opticaldevice 100 includes an optical system 105 having a plurality ofintegrally mounted lenses with a diaphragm disposed between the lensesto form an optical image 107 of the mouth 99 a on an image surface 106.The solid lines in the drawing reaching the image surface 106 indicatethe paths of light forming a bright part of the optical image 107. Thedotted lines are paths of imaginary light corresponding to a dark partin the image and there are no actual light rays along these lines.

The optical image 107 includes, as shown in FIG. 11, a circular brightpart 108 in the center formed by light that has passed through theopening of the mouth, and an annular dark part 109 formed around thebright part indicating the top surface 99 d of the mouth. Between thecircular bright part 108 and the annular dark part 109 are formed aplurality of annular bright parts 110 formed by light reflected by theinner surface of the mouth 99 a (denoted at L_(p) in FIG. 10).Accordingly, this optical image 107 does not provide any accurateinformation regarding the shape of the top surface 99 d or the opening99 c of the mouth, nor does it give any information on the inner contourof the part P where the inner surface protrudes most, i.e., inspectionof the mouth interior is hardly possible with an inspection device ofthe design shown in FIG. 10.

Compared to this, an optical inspection device disclosed before inJapanese Published Unexamined Patent Application No. Hei 8-54213 canform an optical image that provides information on the inner contour ofa container mouth; its optical device uses a telecentric optical system111 shown in FIG. 12.

In FIG. 12, 2 denotes a light source for generating diffused light,which emits light to the bottom 99 b of the container 99. The amount oflight from the light source 2 is controlled by a circular aperture 4 ina diaphragm plate 3. An optical device 6 including the telecentricoptical system 111 is arranged on the optical axis 5 extending throughthe center of the mouth 99 a of the container 99, and an optical imageof the mouth 99 a of the container 99 is formed on an image surface 7consisting of a CCD. The optical image is input to an image processingdevice 8 in which the image of the mouth 99 a is processed for themeasurement of the inside diameter. A display 9 in the drawing is fordisplaying the optical image and input or output data, and the like.

The telecentric optical system 111 is made up of an assembly of lenses10 that can be focused (hereinafter referred to simply as “lens”) and adiaphragm 11 arranged on the optical axis 5 such that an aperture 11 ain the diaphragm 11 is positioned at the focus F of the lens 10. Withthis optical system 111, as shown in FIG. 13, only the light rays thatare parallel to the optical axis 5 are passed through the aperture 11 ain the diaphragm 11 and collected on the image surface 7, after passingthrough and being refracted by the lens 10. The light rays that are notparallel to the optical axis 5, for example, the light rays reflected bythe inner surface of the mouth 99 a or the like, also pass through andare refracted by the lens 10. However, the thus refracted light rays areshut off so that they do not enter the aperture 11 a in the diaphragm11.

In FIG. 13, the paths of light forming a bright part of the opticalimage 12 are indicated by the solid lines, while the paths of imaginarylight corresponding to a dark part are indicated by dotted lines (thereare no actual light rays along these lines).

The lens 10 is set such that the most protruding part P in the innersurface of the mouth 99 a is in focus, and thus the optical system 1 canform an optical image 12 that provides information on the inner contourof the mouth 99 a of the container 99, in particular, of the mostprotruding part P in the inner surface of the mouth 99 a.

This optical image 12 includes, as shown in FIG. 14, a circular brightpart 13 in the center formed by light that has passed through theopening of the mouth, and a first annular dark part 14 therearound thatappears because part of light is shut off by the most protruding part Pof the mouth 99 a, and a second annular dark part 15 formed therearoundindicating the top surface 99 d of the mouth.

This optical image 12 is input to the image processing device 8, inwhich its gray scale image is converted into a binary image to calculateout a largest inscribed circle 16 of the first dark part 14. Thediameter of this largest inscribed circle 16 corresponds to the insidediameter (effective diameter) of the mouth 99 a. Thus, if the measuredinside diameter r is out of a predetermined range, i.e., if r>R1 orr<R2, where R1 and R2 are the upper limit and the lower limit of theinside diameter of the mouth 99 a, respectively, the container isdetermined as defective.

The principal rays parallel to the optical axis 5 for forming theoptical image 12 actually include, as shown in FIG. 15, components oflight directed at a maximum angle of a (indicated by dash-dot lines inthe drawing) in the outer directions around the principal rays L(indicated by solid lines). This results from the diameter of theaperture 11 a in the diaphragm 11 being set large enough to achieve anamount of light necessary for the measurement. A, B, and C in thedrawing denote the points on the container 99 in focus, i.e., theyrepresent the points in the vicinity of the most protruding part P inthe inner surface of the mouth 99 a.

Of the light rays reflected by the vicinities of the most protrudingpart P in the inner surface of the mouth 99 a, particularly those(indicated by L_(p) in FIG. 13) that overlap the components of light L′directed inwardly relative to the principal rays L cause formation of ashadow 18 (see FIG. 14) along the inner edge of the first dark part 14in the optical image 12.

This shadow 18 has an intermediate brightness, and when this appears inthe optical image 12, it makes the inner edge of the first dark part 14indistinct, which can cause erroneous measurement results of thediameter of the largest inscribed circle 16. Another problem is that thebinary threshold level is hard to select when binarizing the gray scaleimage of the optical image 12 in the image processing device.

A possible solution to the problem is, using the diaphragm plate 3, torestrict the paths of the light rays L_(p) reflected by the vicinitiesof the most protruding part P in the inner surface of the mouth 99 a ofthe container 99 to reduce the amount of light that overlaps the lightcomponents L′. This method, however, is not preferable because theinfluence of light refraction at the bottom 99 b of the container 99will be too large.

The reason for using the diffusion light source 2 is to compensate forthe principal rays parallel to the optical axis 5 that are lost by lightrefraction at the bottom 99 b of the container 99 because of the shape,uneven thickness, or an incised mold number or the like of the bottom,by refraction of other angles of light. If the aperture 4 of thediaphragm plate 3 is made smaller to restrict the paths of the reflectedlight L_(p), the principal rays that are lost by the light refraction atthe bottom 99 b caused by its shape or the like cannot be compensatedfor by refraction of other angles of light, as a result of which animage of the container bottom 99 b will appear in the optical image 12.

To avoid this problem, the diameter of the aperture 4 in the diaphragmplate 3 needs to be set substantially large relative to the insidediameter of the mouth 99 a of the container 99 in order to enable thecompensation of the principal rays parallel to the optical axis 5 thatare lost by the light refraction at the bottom 99 b of the container 99caused by its shape or the like by refraction of other angles of light.If the difference between the inside diameter of the mouth and that ofthe bottom of the container is small, the container cannot be placed onthe diaphragm plate 3 when inspected, because the diameter of theaperture 4 in the diaphragm plate 3 will have to be larger than thebottom diameter in order to compensate for the lost principal rays byrefraction of other angles of light. Since the diaphragm plate 3 is usedalso for supporting the container, the container must be suspendedduring inspection if it cannot be placed on the diaphragm plate 3. Onthe other hand, if the diameter of the aperture 4 in the diaphragm plate3 is made small so that the container can be placed on the diaphragmplate 3 during inspection, then the lost principal rays parallel to theoptical axis 5 cannot be compensated for sufficiently by refraction ofother angles of light, as described above.

The present invention was devised based on the foregoing problems, itsobject being to provide a container mouth inspection device which canproduce an ideal optical image that reliably provides information on theinner contour of the container mouth, and which enables accurate andspeedy measurement of the inside diameter or the like of the containermouth.

DISCLOSURE OF THE INVENTION

A container mouth inspection device according to this invention includesa light source for emitting diffused light to a bottom of a containerhaving a mouth, and an optical system in which a lens and a diaphragmare arranged along an optical axis extending through the center of thecontainer mouth. In this invention, the diaphragm is offset backwardfrom a back focus of the lens along the optical axis by a predetermineddistance so as to form an optical image of the mouth in a positionbehind the diaphragm.

In the above-described structure of the invention, the “lens” should beunderstood as including a lens assembly of a plurality of lenses. A“back focus of the lens” can be positioned in back or in front of therearmost lens of the lens assembly. The “diaphragm,” too, can bepositioned in back or in front of the rearmost lens of the lensassembly.

With this structure, the optical image of the mouth includes a circularbright part formed by light passed through the opening of the mouth, andan annular dark part (first dark part) around the bright part, whichappears because part of the light is shut off by a most protruding partin the inner surface of the mouth. This first dark part providesinformation on the inner contour of the container mouth.

When the diaphragm is positioned at the focus of the lens, a shadowappears along the inner edge of the first dark part, which is caused bythe light reflected by the vicinities of the most protruding part in theinner surface of the mouth. However, when the diaphragm is offsetbackward from a back focus of the lens along the optical axis by apredetermined distance, the principal rays are inclined outwardlyrelative to the optical axis. As a result, the light reflected by theinner surface of the mouth does not overlap the components of lightaround the principal rays and does not pass through the aperture in thediaphragm, and therefore the shadow does not appear in the opticalimage.

According to this invention, therefore, an ideal optical image thatreliably provides information on the inner contour of the containermouth can be obtained, and accurate and speedy measurement of the insidediameter or the like of the mouth is possible.

Since the principal rays are converged on the side of the containerbottom relative to the mouth, the principal rays that are lost by lightrefraction at the container bottom caused by its shape or the like canbe compensated for by refraction of other angles of light. Therefore,even if the light source is a small one, no image of the containerbottom will appear in the optical image.

In addition to the above-described structure, the container mouthinspection device of this invention may further include an imageprocessing device for performing image processing of the input opticalimage for measurement of the inside diameter of the mouth.

In a preferred embodiment of this invention, the lens is arranged suchthat the most protruding position in the inner surface of the mouth isin focus. Here, “the most protruding position in the inner surface ofthe mouth,” in other words, is the part where the inside diameter of themouth is smallest, including a locally narrowed part and a narrowed partextending a certain length.

In a preferred embodiment of this invention, the diaphragm is movablealong the optical axis for position adjustment, so that it can be usedfor various types of containers.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a front view illustrating the structure of one embodiment of acontainer mouth inspection device of the present invention;

FIG. 2 is a diagram illustrating the structure of the optical device andlight paths;

FIG. 3 is a diagram illustrating the structure of the optical device andlight paths in another embodiment of the present invention;

FIG. 4 is a diagram illustrating principal rays and other lightcomponents;

FIG. 5 is a diagram illustrating an optical image of a good product;

FIG. 6 is a diagram illustrating an optical image of a defectiveproduct;

FIG. 7 is a cross-sectional view illustrating the container mouth inenlargement;

FIG. 8 is a block diagram illustrating the structure of an imageprocessing device;

FIG. 9 is a diagram illustrating a method of measuring the insidediameter of the container mouth;

FIG. 10 is a diagram illustrating the structure of a common opticalinspection device and light paths;

FIG. 11 is a diagram illustrating an optical image obtained by thedevice of FIG. 10;

FIG. 12 is a front view illustrating the structure of an opticalinspection device using a telecentric optical system;

FIG. 13 is a diagram illustrating the structure of the optical device ofFIG. 12 and light paths;

FIG. 14 is a diagram illustrating an optical image obtained by theoptical device of FIG. 12; and

FIG. 15 is a diagram illustrating the principal rays and other lightcomponents in the optical device of FIG. 12.

BEST MODE FOR CARRYING OUT THE INVENTION

FIG. 1 shows the structure of one embodiment of a container mouthinspection device of the present invention.

The illustrated mouth inspection device is made up of a light projectiondevice 20, an optical device 6, and an image processing device 8 havinga display 9. The light projection device 20 includes a light source 2for generating diffused light and a diaphragm plate 3 having a circularaperture 4 in the center thereof. The amount of light from the lightsource 2 is controlled by the aperture 4 on the diaphragm plate 3 andthe controlled light is projected to the bottom 99b of the container 99.

The container 99 to be inspected is located at an inspection positiondirectly above the light projection device 20. The container 99 isbrought in onto and taken out of the inspection position by acarry-in/out device (not shown).

The optical device 6 includes an optical system 1 arranged on theoptical axis 5 extending through the center of the mouth 99 a of thecontainer 99, and an image surface 7 on which an optical image of themouth 99 a of the container 99 is formed by this optical system 1. Theimage surface 7 is formed by a CCD. The optical image formed on thisimage surface 7 is input to an image processing device 8 in which theimage of the mouth 99 a is processed for the measurement of the insidediameter.

The optical system 1 includes a lens 10 arranged on the optical axis 5and a diaphragm 11 positioned behind the lens 10. The lens 10 is anassembly of lenses that can be focused. The lens 10 is set such that, asshown in FIG. 2, the point inward of the opening 99c by a certaindistance t (e.g., 15 mm) of the mouth 99 a of the container 99, i.e.,the most protruding part P in the inner surface of the mouth 99 a, is infocus. The most protruding part P in the inner surface of the mouth 99 ais not limited to the illustrated position, and it may be, for example,at the opening 99 c of the mouth 99 a. In that case, the lens 10 isarranged such that the vicinity of the opening 99 c is in focus.

The diaphragm 11 has an aperture 11 a in the center. The aperture sizeis varied in accordance with the diaphragm value to regulate the amountof light projected to the image surface 7. The diaphragm value is setappropriately to secure sufficient light necessary for the measurementwith a certain focus depth.

While the diaphragm 11 is fixed in a predetermined position in thisembodiment, it may be structured movable, either electrically ormanually, along the optical axis 5.

Also, while the diaphragm 11 is located behind the lens 10 in thisembodiment because the back focus F of the lens 10 is positioned outsidethe lens 10, the structure shown in FIG. 3 may also be employed in orderto improve aberration and resolution. In the optical system 1 of theembodiment shown in FIG. 3, the back focus F of the lens 10 ispositioned inside the lens 10, and so is the diaphragm 11. In theillustrated example, the lens 10 is an assembly of six lenses 10A to10F; the focus F is positioned between the lenses 10C and 10D, and thediaphragm 11 is arranged in the middle between the lenses 10E and 10F.In the drawing, 50 denotes the lens assembly having the six lenses 10Ato 10F and the diaphragm 11 integrally assembled, and 51 denotes acamera body having the image surface 7 consisting of a CCD. The lensassembly 50 is detachably mounted in the camera body 51. The pluralityof solid lines drawn between the light source 2 and the image surface 7in FIG. 3 represent the paths of light passing through the aperture inthe diaphragm 11.

In the telecentric optical system 111 (shown in FIG. 12) wherein theaperture 11 a of the diaphragm 11 is positioned at the focus F of thelens 10, only the light rays parallel to the optical axis 5 are passedthrough the aperture 11 a of the diaphragm 11 and collected on the imagesurface 7, while the light rays that are not parallel to the opticalaxis 5 are not passed through the aperture 11 a of the diaphragm 11 andshut off at the diaphragm 11.

Compared to this, in the optical system 1 according to the invention,the diaphragm 11 is offset backward from the back focus F of the lens 10(in a direction away from the lens 10) along the optical axis 5 by apredetermined distance d, so that the principal rays L1 to L3 areinclined outward (in a direction away from the optical axis 5). As aresult, the light reflected by the most protruding part P in the innersurface of the mouth 99 a, which would pass through the aperture 11 a ofthe diaphragm 11 if the diaphragm 11 was positioned at the focus F ofthe lens 10, does not pass through the aperture 11 a of the diaphragm 11and is shut off at the diaphragm 11.

Referring now back to FIG. 1 and FIG. 2, the operation of the opticalsystem 1 according to the invention is described in detail below.

The light paths when the diaphragm 11 is positioned behind the backfocus F are as illustrated in FIG. 2. In the drawing, the solid linesindicate the paths of light forming a bright part in the optical image12 on the image surface 7, and the dotted lines indicate the paths ofimaginary light corresponding to a dark part (there are no actual lightrays along these lines).

Of the three principal rays L1 to L3 inclined relative to the opticalaxis 5, the principal ray L1 has passed through the opening of the mouth99 a of the container 99; its path reaches the image surface 7 via theaperture 11 a of the diaphragm 11. The principal ray L2 hits the mostprotruding part P in the inner surface of the mouth 99 a, and itsimaginary light path goes through the aperture 11 a of the diaphragm 11and reaches the image surface 7. The principal ray L3 has transmittedthrough the shoulder 99 e of the container 99 and reached a pointoutside the lens 10; its imaginary light path goes through the aperture11 a of the diaphragm 11 and reaches the image surface 7.

The light ray L4 is the light that hits the most protruding part P inthe inner surface of the mouth 99 a and is reflected; it passes throughthe lens 10, and is shut off at the diaphragm 11, not passing throughthe aperture 11 a of the diaphragm 11.

In the telecentric optical system 111 shown in FIG. 13, the principalrays parallel to the optical axis 5 for forming the optical image 12include, as shown in FIG. 15, components of light directed at a maximumangle of a (indicated by dash-dot lines in the drawing) around theprincipal rays L (indicated by solid lines).

Compared to this, in the optical system 1 according to the invention,because the diaphragm 11 is offset backward from the focus F (away fromthe lens 10) along the optical axis 5 so that the principal rays L areinclined away from the optical axis 5. Accordingly, as shown in FIG. 4,the components of light that are inclined at a maximum angle of α(indicated by dash-dot lines) around the principal rays L are inclinedsimilarly to the principal rays L.

That is, in the telecentric optical system 111 wherein the diaphragm 11is positioned at the focus F of the lens 10, the light reflected by themost protruding part P in the inner surface of the mouth 99 a overlapsthe light components L′ that are inclined inwardly relative to theprincipal rays L when passing through the aperture 11 a of the diaphragm11. Compared to this, in the embodiment shown in FIG. 4, the principalrays L are inclined so that the innermost light components L′ areparallel to the optical axis 5. Thereby, the light reflected by the partP does not pass through the aperture 11 a of the diaphragm 11 and isshut off at the diaphragm 11.

The inclination angle of the principal rays L relative to the opticalaxis 5 need not necessarily be set such that the light components L′will be parallel to the optical axis 5, as long as a proper binary imageof the optical image 12 is obtained (to be described in detail later).If, for example, about one third of the light components inclined at amaximum angle α around the principal rays L are inside of the lightpaths parallel to the optical axis 5, a proper binary image of theoptical image 12 can be obtained by inclining the principal raysrelative to the optical axis 5.

FIG. 5 and FIG. 6 illustrate an optical image 12 formed on the imagesurface 7. The optical image 12 includes a circular bright part 13 inthe center formed by light passed through the opening of the mouth, afirst annular dark part 14 therearound that appears because part oflight is shut off at the most protruding part P in the inner surface ofthe mouth 99 a, and a second annular dark part 15 formed therearoundindicating the top surface 99 d of the mouth. The second dark part 15 ismerged in the first dark part 14, and no shadow is formed along theinner edge of the first dark part 14 which is caused by light reflectionat the inner surface of the mouth 99 a.

FIG. 5 illustrates an optical image 12 of a “good” product, whereas FIG.6 illustrates an optical image 12 of a “defective” product that has aburr on the most protruding part P in the inner surface of the mouth. InFIG. 5, 17 represents the image of the burr.

With the telecentric optical system 111 shown in FIG. 13, because theprincipal rays are parallel to the optical axis 5, the light componentsinclined inwardly relative to the principal rays are shut off by theinner surface of the mouth 99 a, as a result of which the light amountis reduced and an optical image with a sharp edge cannot be obtained.Compared to this, with the optical system 1 according to the invention,because the principal rays are inclined outwardly relative to theoptical axis 5, the light components inclined inwardly relative to theprincipal rays are not shut off by the inner surface of the mouth evenif the most protruding part P extends a substantial length, whereby theedge of the first dark part 14 is clear in the obtained optical image12.

Also, with the optical system 1 according to the invention, other partsthan the most protruding part P can also be inspected. For example, asshown in FIG. 7, an inner part 99 f that is a distance (e.g., 5 mm)below the opening 99 c can be inspected, because the principal rays(indicated by the arrow in the drawing) are inclined relative to theoptical axis 5 and the light is not shut off except at the mostprotruding part P, although the image obtained may be somewhat blurredand less accurate.

Moreover, according to this invention, because the principal rays forforming the optical image 12 are converged on the side of the bottom 99b relative to the mouth 99 a of the container 99, even if the aperture 4of the diaphragm plate 3 is small, the principal rays that are lost bylight refraction at the bottom 99 b of the container 99 caused by itsshape or the like are compensated for by refraction of other angles oflight, and therefore no image of the container bottom 99 b of thecontainer 99 appears in the optical image 12. Accordingly, even whenthere is only a small difference between the inside diameter of themouth and the diameter of the bottom of the container, the principalrays that are lost by light refraction at the bottom 99 b of thecontainer 99 caused by its shape or the like are compensated forsufficiently by refraction of other angles of light, and there is noneed of setting the diameter of the aperture 4 in the diaphragm plate 3larger than the diameter of the bottom. That is, the mouth inspectiondevice of the invention can be used for inspection of the container 99with having a small bottom diameter, because such a container can alsobe placed on the diaphragm plate 3 during inspection.

The image processing device 8 performs preset image processing of theinput optical image 12 for the measurement of the inside diameter of themouth 99 a. It is made up of, as shown in FIG. 8, an image input section21, an image memory 22, an image output section 23, and a controlsection 24,and the like.

The image input section 21 digitalizes the input gray scale imagesignals of the optical image 12, and binarizes the digital gray scaleimage data using a predetermined binary threshold to generate a binaryimage. The image memory 22 is for storing the gray scale image data andits binary image data. The image output section 23 converts the imagedata to analog and outputs the data to the display 9 for displaying theimage.

The control section 24 extracts a largest inscribed circle 16 of animage region corresponding to the first dark part 14 of the binarizedoptical image 12 (see FIG. 5 and FIG. 6), and works out the diameter ofthe largest inscribed circle 16, which is determined as the insidediameter (effective diameter) r of the mouth 99 a of the container 99.The control section 24 then compares the measured inside diameter r withan upper limit R1 and a lower limit R2 of the inside diameter of themouth 99 a. If the inside diameter r is not within the predeterminedrange, i.e., if r>R1 or r<R2, the control section decides that thecontainer is defective.

FIG. 9 illustrates a specific example of the method of measuring theinside diameter r of the mouth 99 a.

In the drawing, 30 represents the outline of the most protruding part inthe inner surface of the mouth 99 a, i.e., the annular boundary betweenthe circular bright part 13 and the first dark part 14 in the opticalimage 12 (hereinafter referred to as “measured figure”).

First, the minimum and maximum Y coordinates Y_(B) and Y_(A) and theminimum and maximum X coordinates X_(D) and X_(C) of the measured FIG.30 in an XY coordinate system are determined. Then, assuming that themeasured FIG. 30 is a true circle, the coordinates of the point ofgravity G of the circle (X_(G), Y_(G)) are calculated out from theequations X_(G)=(X_(C)+X_(D))/2 and Y_(G)=(Y_(A)+Y_(B))/2.

Next, assuming that there is a circle 31 with a diameter of(X_(C)−X_(D)) having the center coinciding with the center of gravity G,a line 32 is drawn with an inclination angle θ(e.g., 10°) passing thecenter of gravity G. Then, the X coordinates X_(F), X_(H) of theintersection points F, H of the line 32 and the imaginary circle 31 arecalculated out from the following equations: $\begin{matrix}{X_{F} = {X_{G} + {{\frac{1}{2} \cdot \left( {X_{C} - X_{D}} \right) \cdot \cos}\quad\theta}}} & (1) \\{X_{H} = {X_{G} - {{\frac{1}{2} \cdot \left( {X_{C} - X_{D}} \right) \cdot \cos}\quad\theta}}} & (2)\end{matrix}$

Next, points F1 and H1 forming the measured FIG. 30 and having the sameX coordinates as the intersection points F and H are extracted. Thesepoints F1 and H1 are extracted by scanning a direction vertical to theX-axis from the intersection points F and H to find the boundary pointsof black pixels and white pixels. The coordinates (X_(F), Y_(F)) and(X_(H), Y_(H)) of the extracted points F1 and H1 are then input to thefollowing equation (3) to obtain the distance R_(θ)between the points F1and H1:R _(θ)=√{square root over ((X _(F) −X _(H))²+(Y _(F) −Y _(H))²)}  (3)

The distance R_(θ) is thus obtained using lines 32 with respectiveinclination angles θ at angular intervals of, for example, 10°, and theminimum value of the distance R_(θ)is determined as the diameter of thelargest inscribed circle 16, i.e., the inside diameter r of the mouth 99a of the container 99. The value r is compared with an upper limit R1and a lower limit R2 of the inside diameter of the mouth 99 a and if itis not within the predetermined range, i.e., if r>R1 or r<R2, it isdetermined that the container is defective.

The maximum value of the distance R_(θ)may be obtained in addition tothe minimum value, and this maximum value may be compared with apredetermined threshold to determine whether the container is good ornot.

The above-described algorithm for measuring the inside diameter r of themouth 99 a of the container 99 is not a requirement, and the diameter rmay be measured by other measurement methods using a differentalgorithm.

1. A container mouth inspection device comprising: a light source foremitting diffused light to a bottom of a container having a mouth; andan optical system in which a lens and a diaphragm are arranged along anoptical axis extending through the center of the container mouth,wherein the diaphragm is offset backward from a back focus of the lensalong the optical axis by a predetermined distance so as to form anoptical image of the mouth in a position behind the diaphragm.
 2. Thecontainer mouth inspection device according to claim 1, wherein the lensis arranged such that a most protruding position in the inner surface ofthe mouth is in focus.
 3. The container mouth inspection deviceaccording to claim 1, wherein the diaphragm is movable along the opticalaxis for position adjustment.
 4. The container mouth inspection deviceaccording to claim 1, further comprising an image processing device forperforming image processing of the input optical image for measurementof an inside diameter of the mouth.
 5. The container mouth inspectiondevice according to claim 2, further comprising an image processingdevice for performing image processing of the input optical image formeasurement of an inside diameter of the mouth.
 6. The container mouthinspection device according to claim 3, further comprising an imageprocessing device for performing image processing of the input opticalimage for measurement of an inside diameter of the mouth.